import { Button, Modal } from "antd";
import { FC, useState } from "react";
import ProblemSelectKnowledge from "./ProblemSelectKnowledge";


const ProblemManageKnowledge: FC<any> = ({knowledgeList, problemId})=>{

  const [isModalOpen, setIsModalOpen] = useState(false);

  const showModal = () => {
    setIsModalOpen(true);
  };

  const handleOk = () => {
    setIsModalOpen(false);
  };

  const handleCancel = () => {
    setIsModalOpen(false);
  };

  return (
    <>
      <Button type="link" onClick={showModal}>
        管理知识点
      </Button>
      <Modal
        title="管理知识点"
        open={isModalOpen}
        onCancel={handleCancel}
        onOk={handleOk}
        footer={null}
      >
        <ProblemSelectKnowledge selectedKnowledge={knowledgeList} problemId={problemId}/>
      </Modal>
    </>
  );

}

export default ProblemManageKnowledge;